package model

import "time"

const (
	TaskStatusCreating = 10 //创建中
	TaskStatusWaiting  = 20 //等待中
	TaskStatusloading  = 30 //下载中
	TaskStatusPauseing = 40 //暂停中
	TaskStatusPaused   = 50 //已暂停
	TaskStatusDeleting = 60 //删除中
	TaskStatusDeleted  = 70 //已删除
	TaskStatusComplete = 80 //已完成
	TaskStatusLoadFail = 90 //下载失败

	DownLoadTaskLoading  = 1 //下载模块中任务未完成
	DownLoadTaskComplete = 2 //下载模块中任务已完成
	DownLoadTaskPause    = 3 //暂停
	DownLoadTaskLoadFail = 4 //下载失败

	//期望状态
	ExceptTaskLoad  = 1 //期待任务下载
	ExceptTaskPause = 2 //期待任务暂停

	//APP中任务状态
	AppTaskLoading  = 1 //下载中
	AppTaskPausing  = 2 //暂停中
	AppTaskWaiting  = 3 //等待中
	AppTaskCreating = 4 //创建中
	AppTaskPaused   = 5 //已暂停
	AppTaskDeleting = 6 //删除中
	AppTaskLoadFail = 7 //下载失败
)

type Task struct {
	TaskID       int64      `db:"task_id" json:"taskId"`
	DeviceID     int        `db:"device_id" json:"device_id,omitempty"`
	TotalSize    int        `db:"total_size" json:"totalSize,omitempty"`
	ResName      string     `db:"res_name" json:"name,omitempty"`
	Path         string     `db:"path" json:"path,omitempty"`
	Status       int        `db:"status" json:"status,omitempty"`
	URL          string     `db:"file_url" json:"url"`
	CompleteTime *time.Time `db:"complete_time" json:"complete_time,omitempty"`
	CreateTime   *time.Time `db:"create_time" json:"create_time,omitempty"`
	DownloadSize int        `json:"downloadedSize,omitempty"`
	Speed        int        `json:"speed,omitempty"`
	Episode      string     `db:"episode" json:"episode,omitempty"`
	Season       string     `db:"season"json:"season,omitempty"`
}
